﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using Sunlit.Business.Enterprises.Dto;
using System.Linq;

namespace Sunlit.Business.Enterprises
{
    public class EnterpriseMessageAppService:AsyncCrudAppService<EnterpriseMessage, EnterpriseMessageDto,long,
        GetAllEnterpriseMessageInput,CreateEnterpriseMessageInput,UpdateEnterpriseMessageInput>,IEnterpriseMessageAppService
    {
        public EnterpriseMessageAppService(IRepository<EnterpriseMessage, long> repository):base(repository)
        {

        }
        protected override IQueryable<EnterpriseMessage> CreateFilteredQuery(GetAllEnterpriseMessageInput input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(input.EnterpriseId.HasValue, e => e.EnterpriseId == input.EnterpriseId)
                .WhereIf(input.ReceiverId.HasValue, e => e.ReceiverId == input.ReceiverId);
        }
    }
}
